package our.pack;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

/* In deze class worden de tabs geimplementeerd, die te zien zijn in het hoofdmenu */

public class GpsTracker1cActivity extends TabActivity {
    /** Called when the activity is first created. */
	
//	private Button mapButton, trackButton, dataButton, settingsButton;
	TracksDataSource trackDatasource;
	PointsDataSource pointsDatasource;
	
	public TabHost tabHost;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        trackDatasource = new TracksDataSource(this);
		trackDatasource.open();
		pointsDatasource = new PointsDataSource(this);
		pointsDatasource.open();
        
        tabHost = getTabHost();
        
        /** Laat de user het GPSmenu zien **/
        TabSpec mapSpec = tabHost.newTabSpec("GPS");
        mapSpec.setIndicator("GPS" , getResources().getDrawable(R.drawable.worldtab));
        Intent mapIntent = new Intent(GpsTracker1cActivity.this, MyMapActivity.class);
        mapSpec.setContent(mapIntent);
        
        /** laat de user het menu zien waar alle media is opgeslagen **/
        TabSpec trackSpec = tabHost.newTabSpec("Tracks");
        trackSpec.setIndicator("Tracks", getResources().getDrawable(R.drawable.tracktab));
        Intent trackIntent = new Intent(GpsTracker1cActivity.this, TrackActivity.class);
        trackSpec.setContent(trackIntent);
        
        /** Laat de user het menu waar alle media staat zien **/
        TabSpec mediaSpec = tabHost.newTabSpec("Media");
        mediaSpec.setIndicator("Media", getResources().getDrawable(R.drawable.mediatab));
        Intent mediaIntent = new Intent(GpsTracker1cActivity.this, MediaActivity.class);
        mediaSpec.setContent(mediaIntent);
        
        /** Laat de user de settings menu zien **/
        TabSpec settingSpec = tabHost.newTabSpec("Settings");
        settingSpec.setIndicator("Info", getResources().getDrawable(R.drawable.settingtab));
        Intent settingIntent = new Intent(GpsTracker1cActivity.this, SettingActivity.class);
        settingSpec.setContent(settingIntent);
        
        tabHost.addTab(mapSpec);
        tabHost.addTab(trackSpec);
        tabHost.addTab(mediaSpec);
        tabHost.addTab(settingSpec);	

       
    }
    
    public TabHost getTabhost(){
    	return tabHost;
    }
    
    public void switchTabMyMapActivity(int tab){
    	tabHost.setCurrentTab(tab);
    }
}